package com.chf.inits;

import com.chf.mods.FirstMod;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

/**
 * 自定义物品栏
 *
 * @author niooooo
 */
public class Tabs {

    public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS =
            DeferredRegister.create(Registries.CREATIVE_MODE_TAB, FirstMod.MOD_ID);

    public static final RegistryObject<CreativeModeTab> ITEMS_TAB = CREATIVE_MODE_TABS.register(
            "items_tab",
            () -> CreativeModeTab.builder()
                    // 1、语言键
                    .title(Component.translatable("itemGroup.firstmod.items"))
                    // 2、图标物品
                    .icon(() -> new ItemStack(Items.FIRST_ITEM.get()))
                    // 3. 添加物品到物品栏
                    .displayItems((params, output) -> {
                        output.accept(Items.FIRST_ITEM.get());
                        output.accept(Items.RED_STONE_SWORD.get());
                        output.accept(Items.OBSIDIAN_SWORD.get());
                        output.accept(Items.OBSIDIAN_PICKAXE.get());
                        output.accept(Items.OBSIDIAN_AXE.get());
                    })
                    .build());
}
